remote-cache: add file:// backend for sharing compiled state between worktrees - #616
Merged
Conversation
…worktrees The build cache only spoke the S3 wire protocol: s3:// went to AWS and any other uri was treated as an S3-compatible HTTP endpoint, with credentials required unconditionally. Pointing the cache at a local directory - the natural setup for sharing compiled state between git worktrees on one machine - was impossible. Push/pull logic was already backend-agnostic (content-digest keys, portable zinc analysis, noop-manifest regeneration on pull), so the backend surface is three operations. Extract that as CacheStore (headObject/getObject/ putObject), implemented by the existing S3Client and a new LocalDirStore that maps keys to files under a root directory. Writes are atomic (temp file + ATOMIC_MOVE) so concurrent pushes of the same digest from different worktrees are safe, and keys are checked against escaping the root. file:// uris skip credential resolution entirely; everything else keeps the existing fail-hard requirement. The new integration test deliberately runs with the harness default config - no remoteCacheCredentials - proving the local backend never asks for them, and covers push layout, noop-manifest exclusion, skip-on-second-push, and pull restoring classes + analysis + regenerated manifest. Co-Authored-By: Claude Fable 5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a local-directory backend to the build cache:
remote-cache: { uri: file:///path/to/cache }inbleep.yamlnow stores entries as plain files instead of requiring an S3-compatible service and credentials.Why
Sharing compiled state between git worktrees on one machine is the motivating case: cache keys are content digests and the shipped zinc analysis is path-portable, so a fresh worktree can
bleep remote-cache pulland skip compiling everything a sibling checkout already built. Until now the cache could only talk to S3-compatible HTTP endpoints, with credentials required unconditionally.How
CacheStore(headObject/getObject/putObject), implemented by the existingS3Clientand a newLocalDirStore.LocalDirStoremaps keys to files under a root directory. Puts are atomic (temp file in target dir +ATOMIC_MOVE), so concurrent pushes of the same digest from different worktrees are safe. Keys are validated against escaping the root.RemoteCache:file://skips credential resolution entirely; every other scheme keeps the existing S3 path with its fail-hard credential requirement.Testing
New
LocalDirCacheITdeliberately runs with the harness default config — noremoteCacheCredentials— proving the local backend never asks for them. Covers push layout (<project>/<digest>.tar.gz, no leftover temp files), noop-manifest exclusion from the archive, skip on second push, and pull restoring classes + analysis + regenerating the manifest. ExistingRemoteCacheIT(S3 path) still passes.🤖 Generated with Claude Code